<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page import="com.bluesky.light.order.*" %>
<%@ page language="java" import="com.bluesky.light.admin.*"%>
<%
	request.setCharacterEncoding("UTF-8");
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%
	Admin admin = (Admin)session.getAttribute("admin");
	if (admin == null) {
		response.sendRedirect("index.jsp");
		return;
	}
	
	String name = admin.getName();//
%>

<%
	List<TreatOrder> orders = OrderService.getInstance().getOrders();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>light</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link href="admin/css/main.css" rel="stylesheet" type="text/css" />
	
  </head>
  
  <body>
	<!-- header -->
	<div id="header">
		<div id="logo"><img src="images/logo_small2.png"/></div>
	</div>
	<!-- // header -->
	<!-- nav -->
	<div id="nav">
	</div>
	<!-- // nav -->
	<!-- container -->
	<div id="container">
		<!-- contents -->
		<div id="contents">
	    	<div id="menu">
	        	<div id="user_info">
	            	<div class="user_icon"><img src="develop/user_icon.jpg"/><br><br></div>
	            	<div><b>Admin</b><br>
	            	<u><%=admin.getName()%></u>
	            	<a href="<%=basePath%>admin/index.jsp">[Logout]</a><br>
	            	<!-- 字符串格式化, %1代表第一個參數DATE(), $tF表示以年月日方式顯示, $tR表示顯示24小時制時分 -->
	            	<%=String.format("%1$tF",new Date()) %><br>
	            	</div>
	            </div><br>
	        	<ul>
	            	<li><a href="admin/user_list.jsp"><img src="images/news.png" /> Users</a></li>
	            	<li><a href="admin/staff_list.jsp"><img src="images/account.png"/> Staffs</a></li>	
	                <li><a href="admin/category_list.jsp"><img src="images/surscribe.png" /> Categories</a></li>
	                <li><a href="admin/order_list.jsp"><img src="images/surscribe.png" /> Orders</a></li>	                
	                <li><a href="admin/product_list.jsp"><img src="images/account.png" /> Products</a></li>	                                
	                <li><a href="admin/financialStatement.jsp"><img src="images/account.png" /> Financial</a></li>
	            </ul>
	        </div>
	        <div id="main-cont">
	            <div id="result">
	                <table class="resulttable" rules="all" >
	                	<caption>Order List</caption>
	                    <tr>
	                        <th>ID</th><th>Date</th><th>Symptom</th><th>Medicine</th><th>Status</th><th>Patient</th><th>Doctor</th>
	                    </tr>
	         			<% 
	         				for (int i = 0; i < orders.size(); i++) {
	         					TreatOrder to = orders.get(i);
	         			%>
	         			<tr>
	         				<td><%=to.getId()%></td>
	         				<td><%=to.getoDate()%></td>
	         				<td><%=to.getSymptom()%></td>
	         				<td></td>
	         				<td><%=to.getStatus()%></td>
	         				<td><%=to.getUsername()%></td>
	         				<td><%=to.getStaffname()%></td>
	         			</tr>
						<%
	         				}
						%>
	                </table>		
	        	</div>
	    </div>
	    <!-- // contents -->
	</div>
	<!-- // container -->
	</div>
	<div id="footer">
		<div id="bs_stdio">
	    	©2011-2011 www.bluesky.com.mo All Rights Reserved<br/>
	    	<img src="images/bluesky_logo.png" />
	    </div>
	</div>
  </body>
</html>
